//
//  GuideViewController.m
//  ForengnMenu
//
//  Created by @-@ on 16/1/21.
//  Copyright © 2016年 余旺. All rights reserved.
//

#import "GuideViewController.h"

@interface GuideViewController ()<UIScrollViewDelegate>

@end

@implementation GuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];


    self.GuideScrollView.contentSize = CGSizeMake(320*3, 568);
    
    NSArray * image = @[@"GuidePage_One",@"GuidePage_Tow",@"GuidePage_There"];
    
    for (int i =0; i<image.count; i++) {
        UIImageView * imageView = [UIImageView new];
        imageView.frame = CGRectMake(320*i, 0, 320, 568);
        imageView.image = [UIImage imageNamed:image[i]];
        
        [self.GuideScrollView addSubview:imageView];
    }
    self.GuideScrollView.delegate = self;
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(320*2+80, 400, 160, 80);
//    btn.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5];
    [btn setTitle:@"         " forState: UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    btn.layer.cornerRadius = 7.0f;
    btn.layer.masksToBounds = YES;
    
    [btn addTarget:self action:@selector(yd) forControlEvents:    UIControlEventTouchUpInside];
    
    [self.GuideScrollView addSubview:btn];
}

-(void)yd{
    
    [self performSegueWithIdentifier:@"showYD" sender:nil];
    
}

#pragma mark - UIScrollViewDelegate

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    //获取滑动的位置
    float offsetX = scrollView.contentOffset.x/320.0f;
    
    //设置当前Page的高亮位置
    self.myPageController.currentPage = offsetX;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
